<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@taglib prefix="FCK" uri="http://java.fckeditor.net" %>
 <%@page import="net.fckeditor.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="sdfi.lee.DAO.NewsDAO"%>
<%@page import="sdfi.lee.Entity.News" %>
<html>
<head>
<link rel="stylesheet" href="<c:url value='/css/adnews.css'></c:url>" />
<script type="text/javascript" src="<c:url value='/js/jquery-1.6.js'></c:url>"></script>
<script type="text/javascript">

	$(function(){
		$('#yes').change(function(event){
			if($(this).is(':checked'))
				$(this).parent("div.items").next("div.items").show();
		});
		$('#no').change(function(event){
			if($(this).is(':checked'))
				$(this).parent("div.items").next("div.items").hide();
				$(this).parent("div.items").siblings("div:has(input[type=file])").remove();
			});
		$(':button').click(function(event){
			if($(this).val()=='+')
			{
				$(this).next(':button').attr('disabled',false);
				$(this).parent('div.items').after("<div class='items'><input type='file' name='picfile' /></div>");
				if($(this).parent('div.items').siblings("div:has(input[type=file])").size()=="5")
				$(this).attr("disabled",true);
			}
			else
			{	$(this).prev(':button').attr('disabled',false);
				$(this).parent('div.items').siblings('div:has(input[type=file]):last').remove();
				if($(this).parent('div.items').siblings("div:has(input[type=file])").size()=="1")
				$(this).attr("disabled",true);
			}
		});
		$('#no').click();
	});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
	<%
		
		FCKeditor editor=new FCKeditor(request,"newscontent");
		Integer id=new Integer(request.getParameter("newsid"));
	 	News news=new NewsDAO().getNewsById(id);
	 	request.setAttribute("news",news);
	 	
	%>
	<div class="contain">
		<form action="newsmodify.action" method="post" enctype="multipart/form-data">
		<input name="id" value=${requestScope.news.id} type="hidden">
		<div class="items">新闻标题：<input type="text" class="text" name="newstitle" value="${requestScope.news.newstitle}" ></div>
		<div class="items">新闻类型：
			<select name="newstype">
						<option value="1" <c:if test='${requestScope.news.newstype==1}'>selected</c:if>>业界动态</option>
						<option value="2" <c:if test='${requestScope.news.newstype==2}'>selected</c:if>>国内动态</option>
						<option value="3" <c:if test='${requestScope.news.newstype==3}'>selected</c:if>>合作交流</option>
						<option value="4" <c:if test='${requestScope.news.newstype==4}'>selected</c:if>>发展规划</option>
						<option value="5" <c:if test='${requestScope.news.newstype==5}'>selected</c:if>>服务指南</option>
						<option value="6" <c:if test='${requestScope.news.newstype==6}'>selected</c:if>>人才招聘</option>
					</select>
		</div>
		
		<div class="item">
		<FCK:editor instanceName="newscontent" value='${requestScope.news.newscontent}' height="400px" width="600px">
		</FCK:editor>
		</div>
		<div class="items">
			修改图片：<input type="radio" name="addpic" class="inputradio" id="yes">是 
					<input id="no" name="addpic" type="radio" class="inputradio" >否
		</div>
		<div class="items"><input type="button" value="+"/>
		<input type="button" value="-" disabled="disabled" /></div>
		<div>
			<input type="submit" value="修改新闻">
		</div>
		</form>
	</div>
</body>
</html>